﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowToPoint : MonoBehaviour
{
    public Transform mover;
    public Transform target;
    public float speed = 1;

    Vector3 point;
    bool isWaiting = false;

    private void OnEnable()
    {
        isWaiting = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (isWaiting)
        {
            mover.position = Vector3.MoveTowards(mover.position, point, speed);
        }
    }

    public void LockPoint()
    {
        point = target.position;
    }

    public void Jump()
    {
        isWaiting = true;
    }
}
